package jp.sourceforge.akjrcp.flvtools.search;

import javax.swing.plaf.basic.BasicBorders.RadioButtonBorder;

import jp.sourceforge.akjrcp.akj_betas.Akj_betasPlugin;
import jp.sourceforge.akjrcp.akj_betas.Messages;
import jp.sourceforge.akjrcp.flvtools.basic.FFMpegPage;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.DirectoryFieldEditor;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;




/**
 * This class represents a preference page that
 * is contributed to the Preferences dialog. By 
 * subclassing <samp>FieldEditorPreferencePage</samp>, we
 * can use the field support built into JFace that allows
 * us to create a page that is small and knows how to 
 * save, restore and apply itself.
 * <p>
 * This page is used to modify preferences only. They
 * are stored in the preference store that belongs to
 * the main plug-in class. That way, preferences can
 * be accessed directly via the preference store.
 */


public class SearchPage
	extends FieldEditorPreferencePage
	implements IWorkbenchPreferencePage {

	public static final String USE_FIREFOX="search.use_firefox";
	public static final String MODE_SORT="search.search_mode";
	
	public static final String SORT_DATE="video_date_uploaded";
	
	public static final String SORT_TITLE="title_sort";
	public static final String SORT_VIEWCOUNT="video_view_count";
	public static final String SORT_RATE="rating_sort";
	public static final String SORT_RELAVANCE="relevance";//we don't use.
	public SearchPage() {
		super(GRID);
		setPreferenceStore(Akj_betasPlugin.getDefault().getPreferenceStore());
		setDescription(Messages.getString("search_setting"));
		initializeDefaults();
		
	}
/**
 * Sets the default values of the preferences.
 */
	private void initializeDefaults() {
		//do plugin init.
	}
	
/**
 * Creates the field editors. Field editors are abstractions of
 * the common GUI blocks needed to manipulate various types
 * of preferences. Each field editor knows how to save and
 * restore itself.
 */

	

    protected void createFieldEditors() {
    	BooleanFieldEditor useFirefox=new BooleanFieldEditor(USE_FIREFOX,"Firefox",getFieldEditorParent());
    
    	addField(useFirefox);
    	
    	addField(new RadioGroupFieldEditor(
		        MODE_SORT,
				Messages.getString("sort_mode"), // //$NON-NLS-1$
				3,
				new String[][] { { Messages.getString("sort_date"), SORT_DATE}, { //$NON-NLS-1$ //$NON-NLS-2$
					Messages.getString("sort_relevance"), SORT_RELAVANCE   //$NON-NLS-1$ //$NON-NLS-2$
				    
				},
				//{ Messages.getString("sort_title"), SORT_TITLE }, //$NON-NLS-1$ //$NON-NLS-2$
				{ Messages.getString("sort_viewcount"), SORT_VIEWCOUNT }, //$NON-NLS-1$ //$NON-NLS-2$
				{ Messages.getString("sort_rate"), SORT_RATE }, //$NON-NLS-1$ //$NON-NLS-2$
				
				
			}, getFieldEditorParent()));
        
    }
	
	public void init(IWorkbench workbench) {
	}
}